Also gave a boolean return value to the callback to allow breaking out of the loop.
gtk_cell_area_add
gtk_cell_area_remove
gtk_cell_area_has_renderer
-gtk_cell_area_forall
+gtk_cell_area_foreach
gtk_cell_area_get_cell_allocation
gtk_cell_area_event
gtk_cell_area_render
gtk_cell_area_context_reset
gtk_cell_area_create_context
gtk_cell_area_event
-gtk_cell_area_forall
+gtk_cell_area_foreach
gtk_cell_area_focus
gtk_cell_area_get_edited_cell
gtk_cell_area_get_edit_widget
static GList *gtk_cell_area_get_cells (GtkCellLayout *cell_layout);
-/* Used in forall loop to check if a child renderer is present */
+/* Used in foreach loop to check if a child renderer is present */
typedef struct {
GtkCellRenderer *renderer;
gboolean has_renderer;
/* general */
class->add = NULL;
class->remove = NULL;
- class->forall = NULL;
+ class->foreach = NULL;
class->event = gtk_cell_area_real_event;
class->render = NULL;
class->apply_attributes = gtk_cell_area_real_apply_attributes;
GTK_CELL_AREA_GET_CLASS (area)->get_preferred_width (area, context, widget, minimum_width, natural_width);
}
-static void
+static gboolean
get_is_activatable (GtkCellRenderer *renderer,
gboolean *activatable)
{
if (gtk_cell_renderer_is_activatable (renderer))
*activatable = TRUE;
+
+ return *activatable;
}
static gboolean
* Subclasses can override this in the case that they are also
* rendering widgets as well as renderers.
*/
- gtk_cell_area_forall (area, (GtkCellCallback)get_is_activatable, &activatable);
+ gtk_cell_area_foreach (area, (GtkCellCallback)get_is_activatable, &activatable);
return activatable;
}
g_type_name (G_TYPE_FROM_INSTANCE (cell_layout)));
}
-static void
+static gboolean
accum_cells (GtkCellRenderer *renderer,
GList **accum)
{
*accum = g_list_prepend (*accum, renderer);
+
+ return FALSE;
}
static GList *
{
GList *cells = NULL;
- gtk_cell_area_forall (GTK_CELL_AREA (cell_layout),
- (GtkCellCallback)accum_cells,
- &cells);
+ gtk_cell_area_foreach (GTK_CELL_AREA (cell_layout),
+ (GtkCellCallback)accum_cells,
+ &cells);
return g_list_reverse (cells);
}
g_type_name (G_TYPE_FROM_INSTANCE (area)));
}
-static void
+static gboolean
get_has_renderer (GtkCellRenderer *renderer,
HasRendererCheck *check)
{
if (renderer == check->renderer)
check->has_renderer = TRUE;
+
+ return check->has_renderer;
}
/**
g_return_val_if_fail (GTK_IS_CELL_AREA (area), FALSE);
g_return_val_if_fail (GTK_IS_CELL_RENDERER (renderer), FALSE);
- gtk_cell_area_forall (area, (GtkCellCallback)get_has_renderer, &check);
+ gtk_cell_area_foreach (area, (GtkCellCallback)get_has_renderer, &check);
return check.has_renderer;
}
/**
- * gtk_cell_area_forall:
+ * gtk_cell_area_foreach:
* @area: a #GtkCellArea
* @callback: the #GtkCellCallback to call
* @callback_data: user provided data pointer
* Since: 3.0
*/
void
-gtk_cell_area_forall (GtkCellArea *area,
- GtkCellCallback callback,
- gpointer callback_data)
+gtk_cell_area_foreach (GtkCellArea *area,
+ GtkCellCallback callback,
+ gpointer callback_data)
{
GtkCellAreaClass *class;
class = GTK_CELL_AREA_GET_CLASS (area);
- if (class->forall)
- class->forall (area, callback, callback_data);
+ if (class->foreach)
+ class->foreach (area, callback, callback_data);
else
- g_warning ("GtkCellAreaClass::forall not implemented for `%s'",
+ g_warning ("GtkCellAreaClass::foreach not implemented for `%s'",
g_type_name (G_TYPE_FROM_INSTANCE (area)));
}
* @data: user-supplied data
*
* The type of the callback functions used for iterating over
- * the cell renderers of a #GtkCellArea, see gtk_cell_area_forall().
+ * the cell renderers of a #GtkCellArea, see gtk_cell_area_foreach().
+ *
+ * Return value: %TRUE to stop iterating over cells.
*/
-typedef void (*GtkCellCallback) (GtkCellRenderer *renderer,
- gpointer data);
+typedef gboolean (*GtkCellCallback) (GtkCellRenderer *renderer,
+ gpointer data);
struct _GtkCellArea
* GtkCellAreaClass:
* @add: adds a #GtkCellRenderer to the area.
* @remove: removes a #GtkCellRenderer from the area.
- * @forall: Calls the #GtkCellCallback function on every #GtkCellRenderer in the area
- * with the provided user data.
+ * @foreach: Calls the #GtkCellCallback function on every #GtkCellRenderer in the area
+ * with the provided user data until the callback returns %TRUE.
* @get_cell_allocation: Gets the position (relative to the passed @cell_area rectangle)
* and size of a #GtkCellRenderer.
* @event: Handle an event in the area, this is generally used to activate a cell
GtkCellRenderer *renderer);
void (* remove) (GtkCellArea *area,
GtkCellRenderer *renderer);
- void (* forall) (GtkCellArea *area,
+ void (* foreach) (GtkCellArea *area,
GtkCellCallback callback,
gpointer callback_data);
void (* get_cell_allocation) (GtkCellArea *area,
GtkCellRenderer *renderer);
gboolean gtk_cell_area_has_renderer (GtkCellArea *area,
GtkCellRenderer *renderer);
-void gtk_cell_area_forall (GtkCellArea *area,
+void gtk_cell_area_foreach (GtkCellArea *area,
GtkCellCallback callback,
gpointer callback_data);
void gtk_cell_area_get_cell_allocation (GtkCellArea *area,
GtkCellRenderer *renderer);
static void gtk_cell_area_box_remove (GtkCellArea *area,
GtkCellRenderer *renderer);
-static void gtk_cell_area_box_forall (GtkCellArea *area,
+static void gtk_cell_area_box_foreach (GtkCellArea *area,
GtkCellCallback callback,
gpointer callback_data);
static void gtk_cell_area_box_get_cell_allocation (GtkCellArea *area,
/* GtkCellAreaClass */
area_class->add = gtk_cell_area_box_add;
area_class->remove = gtk_cell_area_box_remove;
- area_class->forall = gtk_cell_area_box_forall;
+ area_class->foreach = gtk_cell_area_box_foreach;
area_class->get_cell_allocation = gtk_cell_area_box_get_cell_allocation;
area_class->event = gtk_cell_area_box_event;
area_class->render = gtk_cell_area_box_render;
}
static void
-gtk_cell_area_box_forall (GtkCellArea *area,
- GtkCellCallback callback,
- gpointer callback_data)
+gtk_cell_area_box_foreach (GtkCellArea *area,
+ GtkCellCallback callback,
+ gpointer callback_data)
{
GtkCellAreaBox *box = GTK_CELL_AREA_BOX (area);
GtkCellAreaBoxPrivate *priv = box->priv;
{
CellInfo *info = list->data;
- callback (info->renderer, callback_data);
+ if (callback (info->renderer, callback_data))
+ break;
}
}